package core.neural;

import core.*;
import utility.*;

public class BrainParsing {

	public static int INFLUENCE_POS = 0;
	public static int FEROMONS_POS = 1;
	public static int MEMORY_POS = 2;
	
	
	
	
	public static double[] mergeInputs(double[] surroundings, double[] feromons, double[] memory) {
		double[] res = new double[surroundings.length+feromons.length+memory.length+1];
		res[0] = 0;//Utils.random.nextDouble()*2-1;
		System.arraycopy(surroundings, 0, res, 1, surroundings.length);
		System.arraycopy(feromons, 0, res, 1+surroundings.length, feromons.length);
		System.arraycopy(memory, 0, res, 1+surroundings.length+feromons.length, memory.length);
		return res;
	}
	
	
	public static double[][] splitOutput(double[] outputs) {
		double[][] res = new double[3][];
		res[0] = new double[Mode.mode.brain.INFLUENCE];
		res[1] = new double[Mode.mode.brain.FEROMONS];
		res[2] = new double[Mode.mode.brain.MEMORY];
				
		System.arraycopy(outputs, 0, res[0], 0, Mode.mode.brain.INFLUENCE);
		System.arraycopy(outputs, Mode.mode.brain.INFLUENCE, res[1], 0, Mode.mode.brain.FEROMONS);
		System.arraycopy(outputs, Mode.mode.brain.INFLUENCE+Mode.mode.brain.FEROMONS, res[2], 0, Mode.mode.brain.MEMORY);
		return res;
	}
	
}

